﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain.zyy;
using MyMES.Error;
using MyMES.Read.API.Application.Commends.Requisitions;

namespace MyMES.Read.API.Controllers.ZYY.Requisitions
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RequisitionsController : ControllerBase
    {
        private readonly IMediator med;

        public RequisitionsController(IMediator med)
        {
            this.med = med;
        }
        [HttpGet]

        public async Task<APIPaging<List<Requisition>>> Requisition([FromQuery] RequisitionCommand request, CancellationToken cancellationToken)
        {
            try
            {
                return await med.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
           
        }
    }
}
